﻿using System;
using System.Collections.Generic;
using System.Text;

using System.Data.SqlClient;
using System.Collections;
using System.Data;
using Slja.Model;

namespace Slja.BLL
{
    public class ImportData
    {
        private readonly Slja.DAL.ImportData dal = new DAL.ImportData();
        /// <summary>
        /// 执行SQL
        /// </summary>
        /// <param name="strSQL"></param>
        /// <returns></returns>
        public int ExecuteSQL(string strSQL)
        {
            return dal.ExecuteSQL(strSQL);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="TableName">表名</param>
        /// <param name="ht">SQL语句的哈希表（key为sql语句，value是该语句的SqlParameter[]）</param>
        /// <returns></returns>
        public void ImportDataBySQLAndParams(string TableName, Hashtable ht)
        {
            dal.ImportDataBySQLAndParams(ht);
        }
        /// <summary>
        /// 保存要用户比较的字段的列表
        /// </summary>
        /// <param name="TableName"></param>
        /// <param name="ColNames"></param>
        public void SaveComparableTableColumns(string TableName, List<string> ColNames)
        {
            dal.SaveComparableTableColumns(TableName, ColNames);
        }
        /// <summary>
        /// 获取要用户比较的字段的列表
        /// </summary>
        /// <param name="TableName"></param>
        /// <returns></returns>
        public List<string> GetComparableTableColumns(string TableName)
        {
            return dal.GetComparableTableColumns(TableName);
        }
        /// <summary>
        /// 根据表名，取得数据
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public DataTable GetTableDataByName(string tableName)
        {
            return dal.GetTableDataByName(tableName);
        }
        /// <summary>
        /// 表是否存在
        /// </summary>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public Boolean DbTableExists(string tableName)
        {
            return dal.DbTableExists(tableName);
        }
        /// <summary>
        /// 获取合并后的数据
        /// </summary>
        /// <param name="Year">年</param>
        /// <param name="Month">月</param>
        /// <returns></returns>
        public DataTable GetJoinedData(DateTime dt1,DateTime dt2)
        {
            return dal.GetJoinedData(dt1, dt2);
        }
        /// <summary>
        /// 获取合并后的数据
        /// </summary>
        /// <param name="dt1">月份</param>       
        /// <returns></returns>
        public DataTable GetJoinedData(DateTime dt1)
        {
            return dal.GetJoinedData(dt1);
        }
        public DataTable GetTableColumns(string tableName)
        {
            return dal.GetTableColumns(tableName);
        }
        public List<TableCol> GetComparableTableColumnsModel(string TableName)
        {
            return dal.GetComparableTableColumnsModel(TableName);
        }
    }
}
